<!--
Author: Quan Van Sinh
Email : sinhvnb@vietnambiz.com
Mobile: 0972405165
-->

<?php include ADMIN_INCLUDE_DIR."/header.php";?>
<script type="text/javascript">
    function delCatNews(params,text){
        if (confirm('Bạn chắc chắn muốn xóa ' + text + '?')){
            window.location = '<?php echo ADMIN_URL;?>'+params;
        }
    }

    function multiCategoryNewsAction(action){
        objForm = $("#formNewsCategoryView");
        switch (action) {
            case 'delete':
                if (confirm("Bạn có chắc chắn?")){
                    $("#formNewsCategoryViewAction").val('delete');
                    objForm.submit();
                }
                break;
            case 'setStatusYes':
                $("#formNewsCategoryViewAction").val('setStatusYes');
                objForm.submit();
                break;
            case 'setStatusNo':
                $("#formNewsCategoryViewAction").val('setStatusNo');
                objForm.submit();
                break;
        }

    }
</script>
<div class="container_l">
    <div class="title_user"><img src="images/icon4.gif" />Danh sách danh mục Video</div>
    <div class="table_user">
        <form id="formNewsCategoryView" action="" method="post">
            <div class="table_user_in">
                <div class="boxtitle">
                    <div class="d_input">
                        <input id="checkall" type="checkbox"/>
                        <input type="hidden" id="formNewsCategoryViewAction" name="formNewsCategoryViewAction" value=""/>
                        <input type="hidden" id="action" name="action" value="multiAction"/>
                    </div>
                    <div class="d_order2"> Thứ tự</div>
                    <div class="d_title_news_cat" style="width:55%;">Tiêu đề</div>
                    <div class="d_datetime_news_cat">Ngày tạo</div>
                    <div class="d_statusnews">Trạng thái</div>
                    <div class="d_setting">Thao tác</div>
                </div>
                <?php
                $arrNewsCat = listAllNewsCategory($parent_id = 0);
                for($i=0;$i<count($arrNewsCat);$i++) {
                    ?>
                <div class="lineuser">
                    <div class="d_input2"><input type="checkbox" class="check" name="arr_cat_id[]" id="arr_cat_id[]" value="<?php echo $arrNewsCat[$i]['cat_id'];?>" /></div>
                    <div class="d_order2">
                        <a href="?module=video&option=category&action=up&cat_id=<?php echo $arrNewsCat[$i]['cat_id'];?>"><img src="../admincp/images/up.gif" align="center"  alt="up"/></a>
                        &nbsp;&nbsp;&nbsp;<a href="?module=video&option=category&action=down&cat_id=<?php echo $arrNewsCat[$i]['cat_id'];?>"><img src="../admincp/images/down.gif" align="center" alt="down"/></a>
                    </div>
                    <div class="d_title2_news_cat" style="width:50%;"><font class="textbody"><a href="?module=video&keyword=&cat_id=<?php echo $arrNewsCat[$i]['cat_id'];?>&submitFrmNewsSearch=Search"><?php echo $arrNewsCat[$i]['cat_title'];?></a></font></div>
                    <div class="d_datetime2_news_cat"><font class="textbody"><?php echo $arrNewsCat[$i]['create_date'];?></font></div>
                    <div class="d_statusnews2"><font color="#FF0000"><?php if($arrNewsCat[$i]['cat_active']=='yes')echo '<img src="images/active.gif" />';else {echo $arrNewsCat[$i]['cat_active'];}?></font></div>
                    <div class="d_setting2"></a><a href="?module=video&option=category&action=edit&cat_id=<?php echo $arrNewsCat[$i]['cat_id'];?>"><img src="images/edit.gif" alt="Edit profile" title="Edit profile" /></a><a href="javascript: delCatNews('?module=video&option=category&action=del&cat_id=<?php echo $arrNewsCat[$i]['cat_id'];?>','<?php echo htmlentities($arrNewsCat[$i]['cat_title'], ENT_COMPAT, 'UTF-8');?>')"><img src="images/delete.gif" alt="Delete" title="Delete" /></a></div>
                </div>
                <?php
                }
                ?>
                <div class="boxbutton">
                    <input type="button" onclick="javascript: multiCategoryNewsAction('setStatusYes');" value="Kích hoạt" class="button" />
                    <input type="button" onclick="javascript: multiCategoryNewsAction('setStatusNo');" value="Hủy kích hoạt" class="button" />
                    <input type="button" onclick="javascript: multiCategoryNewsAction('delete');" value="Xóa mục đã chọn" class="button" />
                </div>
            </div>
        </form>
    </div>
</div>

<?php
include "inc/right.php";
include ADMIN_INCLUDE_DIR."/footer.php";
?>